#pragma once

#include "..\EdgeMath\Vectors.h"
class GameObject;

class Camera
{
	// the position of the camera relivitve to the lookat point
	Vector3 position;
	// the point the camera looks toward
	Vector3 lookat;
	Vector3 velocity;

	Matrix rotation_matrix;

	float rotation_yaw = 0.f;
	float rotation_pitch = 0.f;

	int viewport_width = 0;
	int viewport_height = 0;

	const float move_speed;
	float target_range = 5.f;

	Camera(int viewport_width, int viewport_height);
	~Camera(void);

	Vector3 target;

	static Camera* instance;
public:

	const float nearPlaneDistance = 0.1f;
	const float farPlaneDistance = 10000.f;

	void Update(float dt);

	Matrix getView(void);
	Matrix getProj(void);
	Matrix getWorld(void);

	Vector3 getPosition(void) const { return position; }
	Vector3 getLookAt(void) const { return lookat; }
	Vector3 getWorldPosition(void) const;

	Vector3 getForwardVector(void);
	Vector3 getRightVector(void);
	Vector3 getUpVector(void);

	Vector3 getTarget(void) const { return target; }

	float getMoveSpeed(void) const { return move_speed; }
	float getTargetRange(void) const { return target_range; }

	void setPosition(Vector3 value) { position = value; }
	void setLookat(Vector3 value) { lookat = value; }
	// sets the distance the camera will stay from its target
	void setTargetRange(float value) { target_range = value; }
	// set the object the camera should follow
	void setTarget(Vector3 value) { target = value; }

	static Camera* GetInstance(void) { return instance; }
	static void Inilitize(int backbuffer_width, int backbuffer_height);
	static void ShutDown(void);
};